<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}</span><span>
</span><span id="line-2"></span><span>
</span><span id="line-3"></span><span class="hs-comment">-- | Handles joining of a jump instruction to its targets.</span><span>
</span><span id="line-4"></span><span>
</span><span id="line-5"></span><span class="hs-comment">--      The first time we encounter a jump to a particular basic block, we</span><span>
</span><span id="line-6"></span><span class="hs-comment">--      record the assignment of temporaries.  The next time we encounter a</span><span>
</span><span id="line-7"></span><span class="hs-comment">--      jump to the same block, we compare our current assignment to the</span><span>
</span><span id="line-8"></span><span class="hs-comment">--      stored one.  They might be different if spilling has occurred in one</span><span>
</span><span id="line-9"></span><span class="hs-comment">--      branch; so some fixup code will be required to match up the assignments.</span><span>
</span><span id="line-10"></span><span class="hs-comment">--</span><span>
</span><span id="line-11"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.CmmToAsm.Reg.Linear.JoinToTargets</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#joinToTargets"><span class="hs-identifier">joinToTargets</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-12"></span><span>
</span><span id="line-13"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-14"></span><span>
</span><span id="line-15"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.State.html"><span class="hs-identifier">GHC.CmmToAsm.Reg.Linear.State</span></a></span><span>
</span><span id="line-16"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html"><span class="hs-identifier">GHC.CmmToAsm.Reg.Linear.Base</span></a></span><span>
</span><span id="line-17"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.FreeRegs.html"><span class="hs-identifier">GHC.CmmToAsm.Reg.Linear.FreeRegs</span></a></span><span>
</span><span id="line-18"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html"><span class="hs-identifier">GHC.CmmToAsm.Reg.Liveness</span></a></span><span>
</span><span id="line-19"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Instr.html"><span class="hs-identifier">GHC.CmmToAsm.Instr</span></a></span><span>
</span><span id="line-20"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Config.html"><span class="hs-identifier">GHC.CmmToAsm.Config</span></a></span><span>
</span><span id="line-21"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html"><span class="hs-identifier">GHC.Platform.Reg</span></a></span><span>
</span><span id="line-22"></span><span>
</span><span id="line-23"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.BlockId.html"><span class="hs-identifier">GHC.Cmm.BlockId</span></a></span><span>
</span><span id="line-24"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.Dataflow.Collections.html"><span class="hs-identifier">GHC.Cmm.Dataflow.Collections</span></a></span><span>
</span><span id="line-25"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Directed.html"><span class="hs-identifier">GHC.Data.Graph.Directed</span></a></span><span>
</span><span id="line-26"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span>
</span><span id="line-27"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.html"><span class="hs-identifier">GHC.Types.Unique</span></a></span><span>
</span><span id="line-28"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.FM.html"><span class="hs-identifier">GHC.Types.Unique.FM</span></a></span><span>
</span><span id="line-29"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.Set.html"><span class="hs-identifier">GHC.Types.Unique.Set</span></a></span><span>
</span><span id="line-30"></span><span>
</span><span id="line-31"></span><span class="hs-comment">-- | For a jump instruction at the end of a block, generate fixup code so its</span><span>
</span><span id="line-32"></span><span class="hs-comment">--      vregs are in the correct regs for its destination.</span><span>
</span><span id="line-33"></span><span class="hs-comment">--</span><span>
</span><span id="line-34"></span><span id="local-6989586621681031962"><span id="local-6989586621681031964"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#joinToTargets"><span class="hs-identifier hs-type">joinToTargets</span></a></span><span>
</span><span id="line-35"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.FreeRegs.html#FR"><span class="hs-identifier hs-type">FR</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681031964"><span class="hs-identifier hs-type">freeRegs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#Instruction"><span class="hs-identifier hs-type">Instruction</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681031962"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681031962"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-36"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#BlockMap"><span class="hs-identifier hs-type">BlockMap</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#RegSet"><span class="hs-identifier hs-type">RegSet</span></a></span><span>              </span><span class="hs-comment">-- ^ maps the unique of the blockid to the set of vregs</span><span>
</span><span id="line-37"></span><span>                                        </span><span class="hs-comment">--      that are known to be live on the entry to each block.</span><span>
</span><span id="line-38"></span><span>
</span><span id="line-39"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Cmm.BlockId.html#BlockId"><span class="hs-identifier hs-type">BlockId</span></a></span><span>                      </span><span class="hs-comment">-- ^ id of the current block</span><span>
</span><span id="line-40"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621681031962"><span class="hs-identifier hs-type">instr</span></a></span><span>                        </span><span class="hs-comment">-- ^ branch instr on the end of the source block.</span><span>
</span><span id="line-41"></span><span>
</span><span id="line-42"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.State.html#RegM"><span class="hs-identifier hs-type">RegM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681031964"><span class="hs-identifier hs-type">freeRegs</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#NatBasicBlock"><span class="hs-identifier hs-type">NatBasicBlock</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681031962"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-comment">-- fresh blocks of fixup code.</span><span>
</span><span id="line-43"></span><span>                         </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621681031962"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">)</span></span></span><span>               </span><span class="hs-comment">-- the original branch</span><span>
</span><span id="line-44"></span><span>                                                </span><span class="hs-comment">-- instruction, but maybe</span><span>
</span><span id="line-45"></span><span>                                                </span><span class="hs-comment">-- patched to jump</span><span>
</span><span id="line-46"></span><span>                                                </span><span class="hs-comment">-- to a fixup block first.</span><span>
</span><span id="line-47"></span><span>
</span><span id="line-48"></span><span id="joinToTargets"><span class="annot"><span class="annottext">joinToTargets :: forall freeRegs instr.
(FR freeRegs, Instruction instr, Outputable instr) =&gt;
BlockMap RegSet
-&gt; BlockId -&gt; instr -&gt; RegM freeRegs ([NatBasicBlock instr], instr)
</span><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#joinToTargets"><span class="hs-identifier hs-var hs-var">joinToTargets</span></a></span></span><span> </span><span id="local-6989586621681031840"><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681031840"><span class="hs-identifier hs-var">block_live</span></a></span></span><span> </span><span id="local-6989586621681031839"><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681031839"><span class="hs-identifier hs-var">id</span></a></span></span><span> </span><span id="local-6989586621681031838"><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681031838"><span class="hs-identifier hs-var">instr</span></a></span></span><span>
</span><span id="line-49"></span><span>
</span><span id="line-50"></span><span>        </span><span class="hs-comment">-- we only need to worry about jump instructions.</span><span>
</span><span id="line-51"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; Bool -&gt; Bool
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">instr -&gt; Bool
forall instr. Instruction instr =&gt; instr -&gt; Bool
</span><a href="GHC.CmmToAsm.Instr.html#isJumpishInstr"><span class="hs-identifier hs-var">isJumpishInstr</span></a></span><span> </span><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681031838"><span class="hs-identifier hs-var">instr</span></a></span><span>
</span><span id="line-52"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([NatBasicBlock instr], instr)
-&gt; RegM freeRegs ([NatBasicBlock instr], instr)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681031838"><span class="hs-identifier hs-var">instr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-53"></span><span>
</span><span id="line-54"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-55"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
-&gt; [NatBasicBlock instr]
-&gt; BlockId
-&gt; instr
-&gt; [BlockId]
-&gt; RegM freeRegs ([NatBasicBlock instr], instr)
forall freeRegs instr.
(FR freeRegs, Instruction instr, Outputable instr) =&gt;
BlockMap RegSet
-&gt; [NatBasicBlock instr]
-&gt; BlockId
-&gt; instr
-&gt; [BlockId]
-&gt; RegM freeRegs ([NatBasicBlock instr], instr)
</span><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#joinToTargets%27"><span class="hs-identifier hs-var">joinToTargets'</span></a></span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681031840"><span class="hs-identifier hs-var">block_live</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681031839"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681031838"><span class="hs-identifier hs-var">instr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">instr -&gt; [BlockId]
forall instr. Instruction instr =&gt; instr -&gt; [BlockId]
</span><a href="GHC.CmmToAsm.Instr.html#jumpDestsOfInstr"><span class="hs-identifier hs-var">jumpDestsOfInstr</span></a></span><span> </span><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681031838"><span class="hs-identifier hs-var">instr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-56"></span><span>
</span><span id="line-57"></span><span class="hs-comment">-----</span><span>
</span><span id="line-58"></span><span id="local-6989586621681031943"><span id="local-6989586621681031944"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#joinToTargets%27"><span class="hs-identifier hs-type">joinToTargets'</span></a></span><span>
</span><span id="line-59"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.FreeRegs.html#FR"><span class="hs-identifier hs-type">FR</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681031944"><span class="hs-identifier hs-type">freeRegs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#Instruction"><span class="hs-identifier hs-type">Instruction</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681031943"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681031943"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-60"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#BlockMap"><span class="hs-identifier hs-type">BlockMap</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#RegSet"><span class="hs-identifier hs-type">RegSet</span></a></span><span>              </span><span class="hs-comment">-- ^ maps the unique of the blockid to the set of vregs</span><span>
</span><span id="line-61"></span><span>                                        </span><span class="hs-comment">--      that are known to be live on the entry to each block.</span><span>
</span><span id="line-62"></span><span>
</span><span id="line-63"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#NatBasicBlock"><span class="hs-identifier hs-type">NatBasicBlock</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681031943"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span>        </span><span class="hs-comment">-- ^ acc blocks of fixup code.</span><span>
</span><span id="line-64"></span><span>
</span><span id="line-65"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Cmm.BlockId.html#BlockId"><span class="hs-identifier hs-type">BlockId</span></a></span><span>                      </span><span class="hs-comment">-- ^ id of the current block</span><span>
</span><span id="line-66"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621681031943"><span class="hs-identifier hs-type">instr</span></a></span><span>                        </span><span class="hs-comment">-- ^ branch instr on the end of the source block.</span><span>
</span><span id="line-67"></span><span>
</span><span id="line-68"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Cmm.BlockId.html#BlockId"><span class="hs-identifier hs-type">BlockId</span></a></span><span class="hs-special">]</span><span>                    </span><span class="hs-comment">-- ^ branch destinations still to consider.</span><span>
</span><span id="line-69"></span><span>
</span><span id="line-70"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.State.html#RegM"><span class="hs-identifier hs-type">RegM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681031944"><span class="hs-identifier hs-type">freeRegs</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#NatBasicBlock"><span class="hs-identifier hs-type">NatBasicBlock</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681031943"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621681031943"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-71"></span><span>
</span><span id="line-72"></span><span class="hs-comment">-- no more targets to consider. all done.</span><span>
</span><span id="line-73"></span><span id="joinToTargets%27"><span class="annot"><span class="annottext">joinToTargets' :: forall freeRegs instr.
(FR freeRegs, Instruction instr, Outputable instr) =&gt;
BlockMap RegSet
-&gt; [NatBasicBlock instr]
-&gt; BlockId
-&gt; instr
-&gt; [BlockId]
-&gt; RegM freeRegs ([NatBasicBlock instr], instr)
</span><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#joinToTargets%27"><span class="hs-identifier hs-var hs-var">joinToTargets'</span></a></span></span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
</span><span class="hs-identifier">_</span></span><span>          </span><span id="local-6989586621681031821"><span class="annot"><span class="annottext">[NatBasicBlock instr]
</span><a href="#local-6989586621681031821"><span class="hs-identifier hs-var">new_blocks</span></a></span></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681031820"><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681031820"><span class="hs-identifier hs-var">instr</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-74"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([NatBasicBlock instr], instr)
-&gt; RegM freeRegs ([NatBasicBlock instr], instr)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[NatBasicBlock instr]
</span><a href="#local-6989586621681031821"><span class="hs-identifier hs-var">new_blocks</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681031820"><span class="hs-identifier hs-var">instr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-75"></span><span>
</span><span id="line-76"></span><span class="hs-comment">-- handle a branch target.</span><span>
</span><span id="line-77"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#joinToTargets%27"><span class="hs-identifier hs-var">joinToTargets'</span></a></span><span> </span><span id="local-6989586621681031819"><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681031819"><span class="hs-identifier hs-var">block_live</span></a></span></span><span> </span><span id="local-6989586621681031818"><span class="annot"><span class="annottext">[NatBasicBlock instr]
</span><a href="#local-6989586621681031818"><span class="hs-identifier hs-var">new_blocks</span></a></span></span><span> </span><span id="local-6989586621681031817"><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681031817"><span class="hs-identifier hs-var">block_id</span></a></span></span><span> </span><span id="local-6989586621681031816"><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681031816"><span class="hs-identifier hs-var">instr</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681031815"><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681031815"><span class="hs-identifier hs-var">dest</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621681031814"><span class="annot"><span class="annottext">[BlockId]
</span><a href="#local-6989586621681031814"><span class="hs-identifier hs-var">dests</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-78"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-79"></span><span>        </span><span class="hs-comment">-- get the map of where the vregs are stored on entry to each basic block.</span><span>
</span><span id="line-80"></span><span>        </span><span id="local-6989586621681031813"><span class="annot"><span class="annottext">BlockAssignment freeRegs
</span><a href="#local-6989586621681031813"><span class="hs-identifier hs-var">block_assig</span></a></span></span><span>     </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RegM freeRegs (BlockAssignment freeRegs)
forall freeRegs. RegM freeRegs (BlockAssignment freeRegs)
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#getBlockAssigR"><span class="hs-identifier hs-var">getBlockAssigR</span></a></span><span>
</span><span id="line-81"></span><span>
</span><span id="line-82"></span><span>        </span><span class="hs-comment">-- get the assignment on entry to the branch instruction.</span><span>
</span><span id="line-83"></span><span>        </span><span id="local-6989586621681031811"><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681031811"><span class="hs-identifier hs-var">assig</span></a></span></span><span>           </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RegM freeRegs (RegMap Loc)
forall freeRegs. RegM freeRegs (RegMap Loc)
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#getAssigR"><span class="hs-identifier hs-var">getAssigR</span></a></span><span>
</span><span id="line-84"></span><span>
</span><span id="line-85"></span><span>        </span><span class="hs-comment">-- adjust the current assignment to remove any vregs that are not live</span><span>
</span><span id="line-86"></span><span>        </span><span class="hs-comment">-- on entry to the destination block.</span><span>
</span><span id="line-87"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681031807"><span class="annot"><span class="annottext">RegSet
</span><a href="#local-6989586621681031807"><span class="hs-identifier hs-var">live_set</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">KeyOf LabelMap -&gt; BlockMap RegSet -&gt; Maybe RegSet
forall (map :: * -&gt; *) a.
IsMap map =&gt;
KeyOf map -&gt; map a -&gt; Maybe a
</span><a href="GHC.Cmm.Dataflow.Collections.html#mapLookup"><span class="hs-identifier hs-var">mapLookup</span></a></span><span> </span><span class="annot"><span class="annottext">KeyOf LabelMap
BlockId
</span><a href="#local-6989586621681031815"><span class="hs-identifier hs-var">dest</span></a></span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681031819"><span class="hs-identifier hs-var">block_live</span></a></span><span>
</span><span id="line-88"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681031805"><span class="annot"><span class="annottext">still_live :: Unique -&gt; p -&gt; Bool
</span><a href="#local-6989586621681031805"><span class="hs-identifier hs-var hs-var">still_live</span></a></span></span><span> </span><span id="local-6989586621681031804"><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681031804"><span class="hs-identifier hs-var">uniq</span></a></span></span><span> </span><span class="annot"><span class="annottext">p
</span><span class="hs-identifier">_</span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681031804"><span class="hs-identifier hs-var">uniq</span></a></span><span> </span><span class="annot"><span class="annottext">Unique -&gt; RegSet -&gt; Bool
forall a. Unique -&gt; UniqSet a -&gt; Bool
</span><a href="GHC.Types.Unique.Set.html#elemUniqSet_Directly"><span class="hs-operator hs-var">`elemUniqSet_Directly`</span></a></span><span> </span><span class="annot"><span class="annottext">RegSet
</span><a href="#local-6989586621681031807"><span class="hs-identifier hs-var">live_set</span></a></span><span>
</span><span id="line-89"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681031802"><span class="annot"><span class="annottext">adjusted_assig :: RegMap Loc
</span><a href="#local-6989586621681031802"><span class="hs-identifier hs-var hs-var">adjusted_assig</span></a></span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Unique -&gt; Loc -&gt; Bool) -&gt; RegMap Loc -&gt; RegMap Loc
forall elt key.
(Unique -&gt; elt -&gt; Bool) -&gt; UniqFM key elt -&gt; UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#filterUFM_Directly"><span class="hs-identifier hs-var">filterUFM_Directly</span></a></span><span> </span><span class="annot"><span class="annottext">Unique -&gt; Loc -&gt; Bool
forall {p}. Unique -&gt; p -&gt; Bool
</span><a href="#local-6989586621681031805"><span class="hs-identifier hs-var">still_live</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681031811"><span class="hs-identifier hs-var">assig</span></a></span><span>
</span><span id="line-90"></span><span>
</span><span id="line-91"></span><span>        </span><span class="hs-comment">-- and free up those registers which are now free.</span><span>
</span><span id="line-92"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681031800"><span class="annot"><span class="annottext">to_free :: [RealReg]
</span><a href="#local-6989586621681031800"><span class="hs-identifier hs-var hs-var">to_free</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-93"></span><span>                </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681031799"><span class="hs-identifier hs-var">r</span></a></span><span>     </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681031798"><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681031798"><span class="hs-identifier hs-var">reg</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681031797"><span class="annot"><span class="annottext">Loc
</span><a href="#local-6989586621681031797"><span class="hs-identifier hs-var">loc</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RegMap Loc -&gt; [(Unique, Loc)]
forall key elt. UniqFM key elt -&gt; [(Unique, elt)]
</span><a href="GHC.Types.Unique.FM.html#nonDetUFMToList"><span class="hs-identifier hs-var">nonDetUFMToList</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681031811"><span class="hs-identifier hs-var">assig</span></a></span><span>
</span><span id="line-94"></span><span>                        </span><span class="hs-comment">-- This is non-deterministic but we do not</span><span>
</span><span id="line-95"></span><span>                        </span><span class="hs-comment">-- currently support deterministic code-generation.</span><span>
</span><span id="line-96"></span><span>                        </span><span class="hs-comment">-- See Note [Unique Determinism and code generation]</span><span>
</span><span id="line-97"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Unique -&gt; RegSet -&gt; Bool
forall a. Unique -&gt; UniqSet a -&gt; Bool
</span><a href="GHC.Types.Unique.Set.html#elemUniqSet_Directly"><span class="hs-identifier hs-var">elemUniqSet_Directly</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681031798"><span class="hs-identifier hs-var">reg</span></a></span><span> </span><span class="annot"><span class="annottext">RegSet
</span><a href="#local-6989586621681031807"><span class="hs-identifier hs-var">live_set</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-98"></span><span>                        </span><span class="hs-special">,</span><span> </span><span id="local-6989586621681031799"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681031799"><span class="hs-identifier hs-var">r</span></a></span></span><span>          </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Loc -&gt; [RealReg]
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#regsOfLoc"><span class="hs-identifier hs-var">regsOfLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Loc
</span><a href="#local-6989586621681031797"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-99"></span><span>
</span><span id="line-100"></span><span>        </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">BlockId -&gt; BlockAssignment freeRegs -&gt; Maybe (freeRegs, RegMap Loc)
forall freeRegs.
BlockId -&gt; BlockAssignment freeRegs -&gt; Maybe (freeRegs, RegMap Loc)
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#lookupBlockAssignment"><span class="hs-identifier hs-var">lookupBlockAssignment</span></a></span><span>  </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681031815"><span class="hs-identifier hs-var">dest</span></a></span><span> </span><span class="annot"><span class="annottext">BlockAssignment freeRegs
</span><a href="#local-6989586621681031813"><span class="hs-identifier hs-var">block_assig</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-101"></span><span>         </span><span class="annot"><span class="annottext">Maybe (freeRegs, RegMap Loc)
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-102"></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
-&gt; [NatBasicBlock instr]
-&gt; BlockId
-&gt; instr
-&gt; BlockId
-&gt; [BlockId]
-&gt; BlockAssignment freeRegs
-&gt; RegMap Loc
-&gt; [RealReg]
-&gt; RegM freeRegs ([NatBasicBlock instr], instr)
forall freeRegs instr.
(FR freeRegs, Instruction instr, Outputable instr) =&gt;
BlockMap RegSet
-&gt; [NatBasicBlock instr]
-&gt; BlockId
-&gt; instr
-&gt; BlockId
-&gt; [BlockId]
-&gt; BlockAssignment freeRegs
-&gt; RegMap Loc
-&gt; [RealReg]
-&gt; RegM freeRegs ([NatBasicBlock instr], instr)
</span><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#joinToTargets_first"><span class="hs-identifier hs-var">joinToTargets_first</span></a></span><span>
</span><span id="line-103"></span><span>                        </span><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681031819"><span class="hs-identifier hs-var">block_live</span></a></span><span> </span><span class="annot"><span class="annottext">[NatBasicBlock instr]
</span><a href="#local-6989586621681031818"><span class="hs-identifier hs-var">new_blocks</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681031817"><span class="hs-identifier hs-var">block_id</span></a></span><span> </span><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681031816"><span class="hs-identifier hs-var">instr</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681031815"><span class="hs-identifier hs-var">dest</span></a></span><span> </span><span class="annot"><span class="annottext">[BlockId]
</span><a href="#local-6989586621681031814"><span class="hs-identifier hs-var">dests</span></a></span><span>
</span><span id="line-104"></span><span>                        </span><span class="annot"><span class="annottext">BlockAssignment freeRegs
</span><a href="#local-6989586621681031813"><span class="hs-identifier hs-var">block_assig</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681031802"><span class="hs-identifier hs-var">adjusted_assig</span></a></span><span> </span><span class="annot"><span class="annottext">[RealReg]
</span><a href="#local-6989586621681031800"><span class="hs-identifier hs-var">to_free</span></a></span><span>
</span><span id="line-105"></span><span>
</span><span id="line-106"></span><span>         </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">freeRegs
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681031792"><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681031792"><span class="hs-identifier hs-var">dest_assig</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-107"></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
-&gt; [NatBasicBlock instr]
-&gt; BlockId
-&gt; instr
-&gt; BlockId
-&gt; [BlockId]
-&gt; RegMap Loc
-&gt; RegMap Loc
-&gt; RegM freeRegs ([NatBasicBlock instr], instr)
forall instr freeRegs.
(Instruction instr, FR freeRegs, Outputable instr) =&gt;
BlockMap RegSet
-&gt; [NatBasicBlock instr]
-&gt; BlockId
-&gt; instr
-&gt; BlockId
-&gt; [BlockId]
-&gt; RegMap Loc
-&gt; RegMap Loc
-&gt; RegM freeRegs ([NatBasicBlock instr], instr)
</span><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#joinToTargets_again"><span class="hs-identifier hs-var">joinToTargets_again</span></a></span><span>
</span><span id="line-108"></span><span>                        </span><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681031819"><span class="hs-identifier hs-var">block_live</span></a></span><span> </span><span class="annot"><span class="annottext">[NatBasicBlock instr]
</span><a href="#local-6989586621681031818"><span class="hs-identifier hs-var">new_blocks</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681031817"><span class="hs-identifier hs-var">block_id</span></a></span><span> </span><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681031816"><span class="hs-identifier hs-var">instr</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681031815"><span class="hs-identifier hs-var">dest</span></a></span><span> </span><span class="annot"><span class="annottext">[BlockId]
</span><a href="#local-6989586621681031814"><span class="hs-identifier hs-var">dests</span></a></span><span>
</span><span id="line-109"></span><span>                        </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681031802"><span class="hs-identifier hs-var">adjusted_assig</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681031792"><span class="hs-identifier hs-var">dest_assig</span></a></span><span>
</span><span id="line-110"></span><span>
</span><span id="line-111"></span><span>
</span><span id="line-112"></span><span class="hs-comment">-- this is the first time we jumped to this block.</span><span>
</span><span id="line-113"></span><span id="local-6989586621681031918"><span id="local-6989586621681031919"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#joinToTargets_first"><span class="hs-identifier hs-type">joinToTargets_first</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.FreeRegs.html#FR"><span class="hs-identifier hs-type">FR</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681031919"><span class="hs-identifier hs-type">freeRegs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#Instruction"><span class="hs-identifier hs-type">Instruction</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681031918"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681031918"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-114"></span><span>                    </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#BlockMap"><span class="hs-identifier hs-type">BlockMap</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#RegSet"><span class="hs-identifier hs-type">RegSet</span></a></span><span>
</span><span id="line-115"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#NatBasicBlock"><span class="hs-identifier hs-type">NatBasicBlock</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681031918"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-116"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Cmm.BlockId.html#BlockId"><span class="hs-identifier hs-type">BlockId</span></a></span><span>
</span><span id="line-117"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621681031918"><span class="hs-identifier hs-type">instr</span></a></span><span>
</span><span id="line-118"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Cmm.BlockId.html#BlockId"><span class="hs-identifier hs-type">BlockId</span></a></span><span>
</span><span id="line-119"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Cmm.BlockId.html#BlockId"><span class="hs-identifier hs-type">BlockId</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-120"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#BlockAssignment"><span class="hs-identifier hs-type">BlockAssignment</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681031919"><span class="hs-identifier hs-type">freeRegs</span></a></span><span>
</span><span id="line-121"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#RegMap"><span class="hs-identifier hs-type">RegMap</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#Loc"><span class="hs-identifier hs-type">Loc</span></a></span><span>
</span><span id="line-122"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-123"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.State.html#RegM"><span class="hs-identifier hs-type">RegM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681031919"><span class="hs-identifier hs-type">freeRegs</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#NatBasicBlock"><span class="hs-identifier hs-type">NatBasicBlock</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681031918"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621681031918"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-124"></span><span id="joinToTargets_first"><span class="annot"><span class="annottext">joinToTargets_first :: forall freeRegs instr.
(FR freeRegs, Instruction instr, Outputable instr) =&gt;
BlockMap RegSet
-&gt; [NatBasicBlock instr]
-&gt; BlockId
-&gt; instr
-&gt; BlockId
-&gt; [BlockId]
-&gt; BlockAssignment freeRegs
-&gt; RegMap Loc
-&gt; [RealReg]
-&gt; RegM freeRegs ([NatBasicBlock instr], instr)
</span><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#joinToTargets_first"><span class="hs-identifier hs-var hs-var">joinToTargets_first</span></a></span></span><span> </span><span id="local-6989586621681031781"><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681031781"><span class="hs-identifier hs-var">block_live</span></a></span></span><span> </span><span id="local-6989586621681031780"><span class="annot"><span class="annottext">[NatBasicBlock instr]
</span><a href="#local-6989586621681031780"><span class="hs-identifier hs-var">new_blocks</span></a></span></span><span> </span><span id="local-6989586621681031779"><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681031779"><span class="hs-identifier hs-var">block_id</span></a></span></span><span> </span><span id="local-6989586621681031778"><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681031778"><span class="hs-identifier hs-var">instr</span></a></span></span><span> </span><span id="local-6989586621681031777"><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681031777"><span class="hs-identifier hs-var">dest</span></a></span></span><span> </span><span id="local-6989586621681031776"><span class="annot"><span class="annottext">[BlockId]
</span><a href="#local-6989586621681031776"><span class="hs-identifier hs-var">dests</span></a></span></span><span>
</span><span id="line-125"></span><span>        </span><span id="local-6989586621681031775"><span class="annot"><span class="annottext">BlockAssignment freeRegs
</span><a href="#local-6989586621681031775"><span class="hs-identifier hs-var">block_assig</span></a></span></span><span> </span><span id="local-6989586621681031774"><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681031774"><span class="hs-identifier hs-var">src_assig</span></a></span></span><span>
</span><span id="line-126"></span><span>        </span><span id="local-6989586621681031773"><span class="annot"><span class="annottext">[RealReg]
</span><a href="#local-6989586621681031773"><span class="hs-identifier hs-var">to_free</span></a></span></span><span>
</span><span id="line-127"></span><span>
</span><span id="line-128"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>   </span><span id="local-6989586621681031772"><span class="annot"><span class="annottext">NCGConfig
</span><a href="#local-6989586621681031772"><span class="hs-identifier hs-var">config</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RegM freeRegs NCGConfig
forall a. RegM a NCGConfig
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#getConfig"><span class="hs-identifier hs-var">getConfig</span></a></span><span>
</span><span id="line-129"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681031770"><span class="annot"><span class="annottext">platform :: Platform
</span><a href="#local-6989586621681031770"><span class="hs-identifier hs-var hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NCGConfig -&gt; Platform
</span><a href="GHC.CmmToAsm.Config.html#ncgPlatform"><span class="hs-identifier hs-var hs-var">ncgPlatform</span></a></span><span> </span><span class="annot"><span class="annottext">NCGConfig
</span><a href="#local-6989586621681031772"><span class="hs-identifier hs-var">config</span></a></span><span>
</span><span id="line-130"></span><span>
</span><span id="line-131"></span><span>        </span><span class="hs-comment">-- free up the regs that are not live on entry to this block.</span><span>
</span><span id="line-132"></span><span>        </span><span id="local-6989586621681031768"><span class="annot"><span class="annottext">freeRegs
</span><a href="#local-6989586621681031768"><span class="hs-identifier hs-var">freeregs</span></a></span></span><span>        </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RegM freeRegs freeRegs
forall freeRegs. RegM freeRegs freeRegs
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#getFreeRegsR"><span class="hs-identifier hs-var">getFreeRegsR</span></a></span><span>
</span><span id="line-133"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681031763"><span class="annot"><span class="annottext">freeregs' :: freeRegs
</span><a href="#local-6989586621681031763"><span class="hs-identifier hs-var hs-var">freeregs'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(freeRegs -&gt; RealReg -&gt; freeRegs)
-&gt; freeRegs -&gt; [RealReg] -&gt; freeRegs
forall (t :: * -&gt; *) b a.
Foldable t =&gt;
(b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var">foldl'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(RealReg -&gt; freeRegs -&gt; freeRegs)
-&gt; freeRegs -&gt; RealReg -&gt; freeRegs
forall a b c. (a -&gt; b -&gt; c) -&gt; b -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#flip"><span class="hs-identifier hs-var">flip</span></a></span><span> </span><span class="annot"><span class="annottext">((RealReg -&gt; freeRegs -&gt; freeRegs)
 -&gt; freeRegs -&gt; RealReg -&gt; freeRegs)
-&gt; (RealReg -&gt; freeRegs -&gt; freeRegs)
-&gt; freeRegs
-&gt; RealReg
-&gt; freeRegs
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Platform -&gt; RealReg -&gt; freeRegs -&gt; freeRegs
forall freeRegs.
FR freeRegs =&gt;
Platform -&gt; RealReg -&gt; freeRegs -&gt; freeRegs
</span><a href="GHC.CmmToAsm.Reg.Linear.FreeRegs.html#frReleaseReg"><span class="hs-identifier hs-var">frReleaseReg</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681031770"><span class="hs-identifier hs-var">platform</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">freeRegs
</span><a href="#local-6989586621681031768"><span class="hs-identifier hs-var">freeregs</span></a></span><span> </span><span class="annot"><span class="annottext">[RealReg]
</span><a href="#local-6989586621681031773"><span class="hs-identifier hs-var">to_free</span></a></span><span>
</span><span id="line-134"></span><span>
</span><span id="line-135"></span><span>        </span><span class="hs-comment">-- remember the current assignment on entry to this block.</span><span>
</span><span id="line-136"></span><span>        </span><span class="annot"><span class="annottext">BlockAssignment freeRegs -&gt; RegM freeRegs ()
forall freeRegs. BlockAssignment freeRegs -&gt; RegM freeRegs ()
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#setBlockAssigR"><span class="hs-identifier hs-var">setBlockAssigR</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">BlockId
-&gt; (freeRegs, RegMap Loc)
-&gt; BlockAssignment freeRegs
-&gt; BlockAssignment freeRegs
forall freeRegs.
BlockId
-&gt; (freeRegs, RegMap Loc)
-&gt; BlockAssignment freeRegs
-&gt; BlockAssignment freeRegs
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#updateBlockAssignment"><span class="hs-identifier hs-var">updateBlockAssignment</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681031777"><span class="hs-identifier hs-var">dest</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">freeRegs
</span><a href="#local-6989586621681031763"><span class="hs-identifier hs-var">freeregs'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681031774"><span class="hs-identifier hs-var">src_assig</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">BlockAssignment freeRegs
</span><a href="#local-6989586621681031775"><span class="hs-identifier hs-var">block_assig</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-137"></span><span>
</span><span id="line-138"></span><span>        </span><span class="annot"><span class="annottext">BlockMap RegSet
-&gt; [NatBasicBlock instr]
-&gt; BlockId
-&gt; instr
-&gt; [BlockId]
-&gt; RegM freeRegs ([NatBasicBlock instr], instr)
forall freeRegs instr.
(FR freeRegs, Instruction instr, Outputable instr) =&gt;
BlockMap RegSet
-&gt; [NatBasicBlock instr]
-&gt; BlockId
-&gt; instr
-&gt; [BlockId]
-&gt; RegM freeRegs ([NatBasicBlock instr], instr)
</span><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#joinToTargets%27"><span class="hs-identifier hs-var">joinToTargets'</span></a></span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681031781"><span class="hs-identifier hs-var">block_live</span></a></span><span> </span><span class="annot"><span class="annottext">[NatBasicBlock instr]
</span><a href="#local-6989586621681031780"><span class="hs-identifier hs-var">new_blocks</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681031779"><span class="hs-identifier hs-var">block_id</span></a></span><span> </span><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681031778"><span class="hs-identifier hs-var">instr</span></a></span><span> </span><span class="annot"><span class="annottext">[BlockId]
</span><a href="#local-6989586621681031776"><span class="hs-identifier hs-var">dests</span></a></span><span>
</span><span id="line-139"></span><span>
</span><span id="line-140"></span><span>
</span><span id="line-141"></span><span class="hs-comment">-- we've jumped to this block before</span><span>
</span><span id="line-142"></span><span id="local-6989586621681031916"><span id="local-6989586621681031917"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#joinToTargets_again"><span class="hs-identifier hs-type">joinToTargets_again</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#Instruction"><span class="hs-identifier hs-type">Instruction</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681031917"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.FreeRegs.html#FR"><span class="hs-identifier hs-type">FR</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681031916"><span class="hs-identifier hs-type">freeRegs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681031917"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-143"></span><span>                    </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#BlockMap"><span class="hs-identifier hs-type">BlockMap</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#RegSet"><span class="hs-identifier hs-type">RegSet</span></a></span><span>
</span><span id="line-144"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#NatBasicBlock"><span class="hs-identifier hs-type">NatBasicBlock</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681031917"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-145"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Cmm.BlockId.html#BlockId"><span class="hs-identifier hs-type">BlockId</span></a></span><span>
</span><span id="line-146"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621681031917"><span class="hs-identifier hs-type">instr</span></a></span><span>
</span><span id="line-147"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Cmm.BlockId.html#BlockId"><span class="hs-identifier hs-type">BlockId</span></a></span><span>
</span><span id="line-148"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Cmm.BlockId.html#BlockId"><span class="hs-identifier hs-type">BlockId</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-149"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Unique.FM.html#UniqFM"><span class="hs-identifier hs-type">UniqFM</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#Reg"><span class="hs-identifier hs-type">Reg</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#Loc"><span class="hs-identifier hs-type">Loc</span></a></span><span>
</span><span id="line-150"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Unique.FM.html#UniqFM"><span class="hs-identifier hs-type">UniqFM</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#Reg"><span class="hs-identifier hs-type">Reg</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#Loc"><span class="hs-identifier hs-type">Loc</span></a></span><span>
</span><span id="line-151"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.State.html#RegM"><span class="hs-identifier hs-type">RegM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681031916"><span class="hs-identifier hs-type">freeRegs</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#NatBasicBlock"><span class="hs-identifier hs-type">NatBasicBlock</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681031917"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621681031917"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-152"></span><span id="joinToTargets_again"><span class="annot"><span class="annottext">joinToTargets_again :: forall instr freeRegs.
(Instruction instr, FR freeRegs, Outputable instr) =&gt;
BlockMap RegSet
-&gt; [NatBasicBlock instr]
-&gt; BlockId
-&gt; instr
-&gt; BlockId
-&gt; [BlockId]
-&gt; RegMap Loc
-&gt; RegMap Loc
-&gt; RegM freeRegs ([NatBasicBlock instr], instr)
</span><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#joinToTargets_again"><span class="hs-identifier hs-var hs-var">joinToTargets_again</span></a></span></span><span>
</span><span id="line-153"></span><span>    </span><span id="local-6989586621681031727"><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681031727"><span class="hs-identifier hs-var">block_live</span></a></span></span><span> </span><span id="local-6989586621681031726"><span class="annot"><span class="annottext">[NatBasicBlock instr]
</span><a href="#local-6989586621681031726"><span class="hs-identifier hs-var">new_blocks</span></a></span></span><span> </span><span id="local-6989586621681031725"><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681031725"><span class="hs-identifier hs-var">block_id</span></a></span></span><span> </span><span id="local-6989586621681031724"><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681031724"><span class="hs-identifier hs-var">instr</span></a></span></span><span> </span><span id="local-6989586621681031723"><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681031723"><span class="hs-identifier hs-var">dest</span></a></span></span><span> </span><span id="local-6989586621681031722"><span class="annot"><span class="annottext">[BlockId]
</span><a href="#local-6989586621681031722"><span class="hs-identifier hs-var">dests</span></a></span></span><span>
</span><span id="line-154"></span><span>    </span><span id="local-6989586621681031721"><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681031721"><span class="hs-identifier hs-var">src_assig</span></a></span></span><span> </span><span id="local-6989586621681031720"><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681031720"><span class="hs-identifier hs-var">dest_assig</span></a></span></span><span>
</span><span id="line-155"></span><span>
</span><span id="line-156"></span><span>        </span><span class="hs-comment">-- the assignments already match, no problem.</span><span>
</span><span id="line-157"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">RegMap Loc -&gt; [(Unique, Loc)]
forall key elt. UniqFM key elt -&gt; [(Unique, elt)]
</span><a href="GHC.Types.Unique.FM.html#nonDetUFMToList"><span class="hs-identifier hs-var">nonDetUFMToList</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681031720"><span class="hs-identifier hs-var">dest_assig</span></a></span><span> </span><span class="annot"><span class="annottext">[(Unique, Loc)] -&gt; [(Unique, Loc)] -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">RegMap Loc -&gt; [(Unique, Loc)]
forall key elt. UniqFM key elt -&gt; [(Unique, elt)]
</span><a href="GHC.Types.Unique.FM.html#nonDetUFMToList"><span class="hs-identifier hs-var">nonDetUFMToList</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681031721"><span class="hs-identifier hs-var">src_assig</span></a></span><span>
</span><span id="line-158"></span><span>        </span><span class="hs-comment">-- This is non-deterministic but we do not</span><span>
</span><span id="line-159"></span><span>        </span><span class="hs-comment">-- currently support deterministic code-generation.</span><span>
</span><span id="line-160"></span><span>        </span><span class="hs-comment">-- See Note [Unique Determinism and code generation]</span><span>
</span><span id="line-161"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
-&gt; [NatBasicBlock instr]
-&gt; BlockId
-&gt; instr
-&gt; [BlockId]
-&gt; RegM freeRegs ([NatBasicBlock instr], instr)
forall freeRegs instr.
(FR freeRegs, Instruction instr, Outputable instr) =&gt;
BlockMap RegSet
-&gt; [NatBasicBlock instr]
-&gt; BlockId
-&gt; instr
-&gt; [BlockId]
-&gt; RegM freeRegs ([NatBasicBlock instr], instr)
</span><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#joinToTargets%27"><span class="hs-identifier hs-var">joinToTargets'</span></a></span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681031727"><span class="hs-identifier hs-var">block_live</span></a></span><span> </span><span class="annot"><span class="annottext">[NatBasicBlock instr]
</span><a href="#local-6989586621681031726"><span class="hs-identifier hs-var">new_blocks</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681031725"><span class="hs-identifier hs-var">block_id</span></a></span><span> </span><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681031724"><span class="hs-identifier hs-var">instr</span></a></span><span> </span><span class="annot"><span class="annottext">[BlockId]
</span><a href="#local-6989586621681031722"><span class="hs-identifier hs-var">dests</span></a></span><span>
</span><span id="line-162"></span><span>
</span><span id="line-163"></span><span>        </span><span class="hs-comment">-- assignments don't match, need fixup code</span><span>
</span><span id="line-164"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-165"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-166"></span><span>
</span><span id="line-167"></span><span>                </span><span class="hs-comment">-- make a graph of what things need to be moved where.</span><span>
</span><span id="line-168"></span><span>                </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681031719"><span class="annot"><span class="annottext">graph :: [Node Loc Unique]
</span><a href="#local-6989586621681031719"><span class="hs-identifier hs-var hs-var">graph</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RegMap Loc -&gt; RegMap Loc -&gt; [Node Loc Unique]
</span><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#makeRegMovementGraph"><span class="hs-identifier hs-var">makeRegMovementGraph</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681031721"><span class="hs-identifier hs-var">src_assig</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681031720"><span class="hs-identifier hs-var">dest_assig</span></a></span><span>
</span><span id="line-169"></span><span>
</span><span id="line-170"></span><span>                </span><span class="hs-comment">-- look for cycles in the graph. This can happen if regs need to be swapped.</span><span>
</span><span id="line-171"></span><span>                </span><span class="hs-comment">-- Note that we depend on the fact that this function does a</span><span>
</span><span id="line-172"></span><span>                </span><span class="hs-comment">--      bottom up traversal of the tree-like portions of the graph.</span><span>
</span><span id="line-173"></span><span>                </span><span class="hs-comment">--</span><span>
</span><span id="line-174"></span><span>                </span><span class="hs-comment">--  eg, if we have</span><span>
</span><span id="line-175"></span><span>                </span><span class="hs-comment">--      R1 -&gt; R2 -&gt; R3</span><span>
</span><span id="line-176"></span><span>                </span><span class="hs-comment">--</span><span>
</span><span id="line-177"></span><span>                </span><span class="hs-comment">--  ie move value in R1 to R2 and value in R2 to R3.</span><span>
</span><span id="line-178"></span><span>                </span><span class="hs-comment">--</span><span>
</span><span id="line-179"></span><span>                </span><span class="hs-comment">-- We need to do the R2 -&gt; R3 move before R1 -&gt; R2.</span><span>
</span><span id="line-180"></span><span>                </span><span class="hs-comment">--</span><span>
</span><span id="line-181"></span><span>                </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681031715"><span class="annot"><span class="annottext">sccs :: [SCC (Node Loc Unique)]
</span><a href="#local-6989586621681031715"><span class="hs-identifier hs-var hs-var">sccs</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Node Loc Unique] -&gt; [SCC (Node Loc Unique)]
forall key payload.
Ord key =&gt;
[Node key payload] -&gt; [SCC (Node key payload)]
</span><a href="GHC.Data.Graph.Directed.html#stronglyConnCompFromEdgedVerticesOrdR"><span class="hs-identifier hs-var">stronglyConnCompFromEdgedVerticesOrdR</span></a></span><span> </span><span class="annot"><span class="annottext">[Node Loc Unique]
</span><a href="#local-6989586621681031719"><span class="hs-identifier hs-var">graph</span></a></span><span>
</span><span id="line-182"></span><span>
</span><span id="line-183"></span><span>              </span><span class="hs-comment">-- debugging</span><span>
</span><span id="line-184"></span><span>                </span><span class="hs-comment">{-
                pprTrace
                        (&quot;joinToTargets: making fixup code&quot;)
                        (vcat   [ text &quot;        in block: &quot;     &lt;&gt; ppr block_id
                                , text &quot; jmp instruction: &quot;     &lt;&gt; ppr instr
                                , text &quot;  src assignment: &quot;     &lt;&gt; ppr src_assig
                                , text &quot; dest assignment: &quot;     &lt;&gt; ppr dest_assig
                                , text &quot;  movement graph: &quot;     &lt;&gt; ppr graph
                                , text &quot;   sccs of graph: &quot;     &lt;&gt; ppr sccs
                                , text &quot;&quot;])
                        (return ())
                -}</span><span>
</span><span id="line-196"></span><span>                </span><span id="local-6989586621681031713"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681031713"><span class="hs-identifier hs-var">delta</span></a></span></span><span>           </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RegM freeRegs Int
forall freeRegs. RegM freeRegs Int
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#getDeltaR"><span class="hs-identifier hs-var">getDeltaR</span></a></span><span>
</span><span id="line-197"></span><span>                </span><span id="local-6989586621681031711"><span class="annot"><span class="annottext">[[instr]]
</span><a href="#local-6989586621681031711"><span class="hs-identifier hs-var">fixUpInstrs_</span></a></span></span><span>    </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(SCC (Node Loc Unique) -&gt; RegM freeRegs [instr])
-&gt; [SCC (Node Loc Unique)] -&gt; RegM freeRegs [[instr]]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; instr -&gt; SCC (Node Loc Unique) -&gt; RegM freeRegs [instr]
forall instr freeRegs.
Instruction instr =&gt;
Int -&gt; instr -&gt; SCC (Node Loc Unique) -&gt; RegM freeRegs [instr]
</span><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#handleComponent"><span class="hs-identifier hs-var">handleComponent</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681031713"><span class="hs-identifier hs-var">delta</span></a></span><span> </span><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681031724"><span class="hs-identifier hs-var">instr</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[SCC (Node Loc Unique)]
</span><a href="#local-6989586621681031715"><span class="hs-identifier hs-var">sccs</span></a></span><span>
</span><span id="line-198"></span><span>                </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681031707"><span class="annot"><span class="annottext">fixUpInstrs :: [instr]
</span><a href="#local-6989586621681031707"><span class="hs-identifier hs-var hs-var">fixUpInstrs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[[instr]] -&gt; [instr]
forall (t :: * -&gt; *) a. Foldable t =&gt; t [a] -&gt; [a]
</span><a href="../../base/src/Data.Foldable.html#concat"><span class="hs-identifier hs-var">concat</span></a></span><span> </span><span class="annot"><span class="annottext">[[instr]]
</span><a href="#local-6989586621681031711"><span class="hs-identifier hs-var">fixUpInstrs_</span></a></span><span>
</span><span id="line-199"></span><span>
</span><span id="line-200"></span><span>                </span><span class="hs-comment">-- make a new basic block containing the fixup code.</span><span>
</span><span id="line-201"></span><span>                </span><span class="hs-comment">--      A the end of the current block we will jump to the fixup one,</span><span>
</span><span id="line-202"></span><span>                </span><span class="hs-comment">--      then that will jump to our original destination.</span><span>
</span><span id="line-203"></span><span>                </span><span id="local-6989586621681031705"><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681031705"><span class="hs-identifier hs-var">fixup_block_id</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Unique -&gt; BlockId
</span><a href="GHC.Cmm.BlockId.html#mkBlockId"><span class="hs-identifier hs-var">mkBlockId</span></a></span><span> </span><span class="annot"><span class="annottext">(Unique -&gt; BlockId)
-&gt; RegM freeRegs Unique -&gt; RegM freeRegs BlockId
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">RegM freeRegs Unique
forall freeRegs. RegM freeRegs Unique
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#getUniqueR"><span class="hs-identifier hs-var">getUniqueR</span></a></span><span>
</span><span id="line-204"></span><span>                </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681031700"><span class="annot"><span class="annottext">block :: NatBasicBlock instr
</span><a href="#local-6989586621681031700"><span class="hs-identifier hs-var hs-var">block</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">BlockId -&gt; [instr] -&gt; NatBasicBlock instr
forall i. BlockId -&gt; [i] -&gt; GenBasicBlock i
</span><a href="GHC.Cmm.html#BasicBlock"><span class="hs-identifier hs-var">BasicBlock</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681031705"><span class="hs-identifier hs-var">fixup_block_id</span></a></span><span>
</span><span id="line-205"></span><span>                                </span><span class="annot"><span class="annottext">([instr] -&gt; NatBasicBlock instr) -&gt; [instr] -&gt; NatBasicBlock instr
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681031707"><span class="hs-identifier hs-var">fixUpInstrs</span></a></span><span> </span><span class="annot"><span class="annottext">[instr] -&gt; [instr] -&gt; [instr]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId -&gt; [instr]
forall instr. Instruction instr =&gt; BlockId -&gt; [instr]
</span><a href="GHC.CmmToAsm.Instr.html#mkJumpInstr"><span class="hs-identifier hs-var">mkJumpInstr</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681031723"><span class="hs-identifier hs-var">dest</span></a></span><span>
</span><span id="line-206"></span><span>
</span><span id="line-207"></span><span>                </span><span class="hs-comment">-- if we didn't need any fixups, then don't include the block</span><span>
</span><span id="line-208"></span><span>                </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681031707"><span class="hs-identifier hs-var">fixUpInstrs</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-209"></span><span>                 </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
-&gt; [NatBasicBlock instr]
-&gt; BlockId
-&gt; instr
-&gt; [BlockId]
-&gt; RegM freeRegs ([NatBasicBlock instr], instr)
forall freeRegs instr.
(FR freeRegs, Instruction instr, Outputable instr) =&gt;
BlockMap RegSet
-&gt; [NatBasicBlock instr]
-&gt; BlockId
-&gt; instr
-&gt; [BlockId]
-&gt; RegM freeRegs ([NatBasicBlock instr], instr)
</span><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#joinToTargets%27"><span class="hs-identifier hs-var">joinToTargets'</span></a></span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681031727"><span class="hs-identifier hs-var">block_live</span></a></span><span> </span><span class="annot"><span class="annottext">[NatBasicBlock instr]
</span><a href="#local-6989586621681031726"><span class="hs-identifier hs-var">new_blocks</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681031725"><span class="hs-identifier hs-var">block_id</span></a></span><span> </span><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681031724"><span class="hs-identifier hs-var">instr</span></a></span><span> </span><span class="annot"><span class="annottext">[BlockId]
</span><a href="#local-6989586621681031722"><span class="hs-identifier hs-var">dests</span></a></span><span>
</span><span id="line-210"></span><span>
</span><span id="line-211"></span><span>                 </span><span class="hs-comment">-- patch the original branch instruction so it goes to our</span><span>
</span><span id="line-212"></span><span>                 </span><span class="hs-comment">--     fixup block instead.</span><span>
</span><span id="line-213"></span><span>                 </span><span class="annot"><span class="annottext">[instr]
</span><span class="hs-identifier">_</span></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span>  </span><span id="local-6989586621681031694"><span class="annot"><span class="annottext">instr' :: instr
</span><a href="#local-6989586621681031694"><span class="hs-identifier hs-var hs-var">instr'</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">instr -&gt; (BlockId -&gt; BlockId) -&gt; instr
forall instr.
Instruction instr =&gt;
instr -&gt; (BlockId -&gt; BlockId) -&gt; instr
</span><a href="GHC.CmmToAsm.Instr.html#patchJumpInstr"><span class="hs-identifier hs-var">patchJumpInstr</span></a></span><span> </span><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681031724"><span class="hs-identifier hs-var">instr</span></a></span><span>
</span><span id="line-214"></span><span>                                            </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621681031692"><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681031692"><span class="hs-identifier hs-var">bid</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681031692"><span class="hs-identifier hs-var">bid</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId -&gt; BlockId -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681031723"><span class="hs-identifier hs-var">dest</span></a></span><span>
</span><span id="line-215"></span><span>                                                        </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681031705"><span class="hs-identifier hs-var">fixup_block_id</span></a></span><span>
</span><span id="line-216"></span><span>                                                        </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681031692"><span class="hs-identifier hs-var">bid</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- no change!</span><span>
</span><span id="line-217"></span><span>
</span><span id="line-218"></span><span>                           </span><span class="hs-keyword">in</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-219"></span><span>                                </span><span class="hs-comment">{- --debugging
                                pprTrace &quot;FixUpEdge info:&quot;
                                    (
                                    text &quot;inBlock:&quot; &lt;&gt; ppr block_id $$
                                    text &quot;instr:&quot; &lt;&gt; ppr instr $$
                                    text &quot;instr':&quot; &lt;&gt; ppr instr' $$
                                    text &quot;fixup_block_id':&quot; &lt;&gt;
                                        ppr fixup_block_id $$
                                    text &quot;dest:&quot; &lt;&gt; ppr dest
                                    ) (return ())
                                -}</span><span>
</span><span id="line-230"></span><span>                                </span><span class="annot"><span class="annottext">BlockId -&gt; BlockId -&gt; BlockId -&gt; RegM freeRegs ()
forall freeRegs. BlockId -&gt; BlockId -&gt; BlockId -&gt; RegM freeRegs ()
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#recordFixupBlock"><span class="hs-identifier hs-var">recordFixupBlock</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681031725"><span class="hs-identifier hs-var">block_id</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681031705"><span class="hs-identifier hs-var">fixup_block_id</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681031723"><span class="hs-identifier hs-var">dest</span></a></span><span>
</span><span id="line-231"></span><span>                                </span><span class="annot"><span class="annottext">BlockMap RegSet
-&gt; [NatBasicBlock instr]
-&gt; BlockId
-&gt; instr
-&gt; [BlockId]
-&gt; RegM freeRegs ([NatBasicBlock instr], instr)
forall freeRegs instr.
(FR freeRegs, Instruction instr, Outputable instr) =&gt;
BlockMap RegSet
-&gt; [NatBasicBlock instr]
-&gt; BlockId
-&gt; instr
-&gt; [BlockId]
-&gt; RegM freeRegs ([NatBasicBlock instr], instr)
</span><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#joinToTargets%27"><span class="hs-identifier hs-var">joinToTargets'</span></a></span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681031727"><span class="hs-identifier hs-var">block_live</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">NatBasicBlock instr
</span><a href="#local-6989586621681031700"><span class="hs-identifier hs-var">block</span></a></span><span> </span><span class="annot"><span class="annottext">NatBasicBlock instr
-&gt; [NatBasicBlock instr] -&gt; [NatBasicBlock instr]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[NatBasicBlock instr]
</span><a href="#local-6989586621681031726"><span class="hs-identifier hs-var">new_blocks</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-232"></span><span>                                               </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681031725"><span class="hs-identifier hs-var">block_id</span></a></span><span> </span><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681031694"><span class="hs-identifier hs-var">instr'</span></a></span><span> </span><span class="annot"><span class="annottext">[BlockId]
</span><a href="#local-6989586621681031722"><span class="hs-identifier hs-var">dests</span></a></span><span>
</span><span id="line-233"></span><span>
</span><span id="line-234"></span><span>
</span><span id="line-235"></span><span class="hs-comment">-- | Construct a graph of register\/spill movements.</span><span>
</span><span id="line-236"></span><span class="hs-comment">--</span><span>
</span><span id="line-237"></span><span class="hs-comment">--      Cyclic components seem to occur only very rarely.</span><span>
</span><span id="line-238"></span><span class="hs-comment">--</span><span>
</span><span id="line-239"></span><span class="hs-comment">--      We cut some corners by not handling memory-to-memory moves.</span><span>
</span><span id="line-240"></span><span class="hs-comment">--      This shouldn't happen because every temporary gets its own stack slot.</span><span>
</span><span id="line-241"></span><span class="hs-comment">--</span><span>
</span><span id="line-242"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#makeRegMovementGraph"><span class="hs-identifier hs-type">makeRegMovementGraph</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#RegMap"><span class="hs-identifier hs-type">RegMap</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#Loc"><span class="hs-identifier hs-type">Loc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#RegMap"><span class="hs-identifier hs-type">RegMap</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#Loc"><span class="hs-identifier hs-type">Loc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Data.Graph.Directed.html#Node"><span class="hs-identifier hs-type">Node</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#Loc"><span class="hs-identifier hs-type">Loc</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Unique.html#Unique"><span class="hs-identifier hs-type">Unique</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-243"></span><span id="makeRegMovementGraph"><span class="annot"><span class="annottext">makeRegMovementGraph :: RegMap Loc -&gt; RegMap Loc -&gt; [Node Loc Unique]
</span><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#makeRegMovementGraph"><span class="hs-identifier hs-var hs-var">makeRegMovementGraph</span></a></span></span><span> </span><span id="local-6989586621681031690"><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681031690"><span class="hs-identifier hs-var">adjusted_assig</span></a></span></span><span> </span><span id="local-6989586621681031689"><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681031689"><span class="hs-identifier hs-var">dest_assig</span></a></span></span><span>
</span><span id="line-244"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">Node Loc Unique
</span><a href="#local-6989586621681031688"><span class="hs-identifier hs-var">node</span></a></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681031687"><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681031687"><span class="hs-identifier hs-var">vreg</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681031686"><span class="annot"><span class="annottext">Loc
</span><a href="#local-6989586621681031686"><span class="hs-identifier hs-var">src</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RegMap Loc -&gt; [(Unique, Loc)]
forall key elt. UniqFM key elt -&gt; [(Unique, elt)]
</span><a href="GHC.Types.Unique.FM.html#nonDetUFMToList"><span class="hs-identifier hs-var">nonDetUFMToList</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681031690"><span class="hs-identifier hs-var">adjusted_assig</span></a></span><span>
</span><span id="line-245"></span><span>                    </span><span class="hs-comment">-- This is non-deterministic but we do not</span><span>
</span><span id="line-246"></span><span>                    </span><span class="hs-comment">-- currently support deterministic code-generation.</span><span>
</span><span id="line-247"></span><span>                    </span><span class="hs-comment">-- See Note [Unique Determinism and code generation]</span><span>
</span><span id="line-248"></span><span>                    </span><span class="hs-comment">-- source reg might not be needed at the dest:</span><span>
</span><span id="line-249"></span><span>                </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681031685"><span class="annot"><span class="annottext">Loc
</span><a href="#local-6989586621681031685"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">RegMap Loc -&gt; Unique -&gt; Maybe Loc
forall key elt. UniqFM key elt -&gt; Unique -&gt; Maybe elt
</span><a href="GHC.Types.Unique.FM.html#lookupUFM_Directly"><span class="hs-identifier hs-var">lookupUFM_Directly</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681031689"><span class="hs-identifier hs-var">dest_assig</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681031687"><span class="hs-identifier hs-var">vreg</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-250"></span><span>                </span><span class="hs-special">,</span><span> </span><span id="local-6989586621681031688"><span class="annot"><span class="annottext">Node Loc Unique
</span><a href="#local-6989586621681031688"><span class="hs-identifier hs-var">node</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Unique -&gt; Loc -&gt; Loc -&gt; [Node Loc Unique]
forall a. a -&gt; Loc -&gt; Loc -&gt; [Node Loc a]
</span><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#expandNode"><span class="hs-identifier hs-var">expandNode</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681031687"><span class="hs-identifier hs-var">vreg</span></a></span><span> </span><span class="annot"><span class="annottext">Loc
</span><a href="#local-6989586621681031686"><span class="hs-identifier hs-var">src</span></a></span><span> </span><span class="annot"><span class="annottext">Loc
</span><a href="#local-6989586621681031685"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-251"></span><span>
</span><span id="line-252"></span><span>
</span><span id="line-253"></span><span class="hs-comment">-- | Expand out the destination, so InBoth destinations turn into</span><span>
</span><span id="line-254"></span><span class="hs-comment">--      a combination of InReg and InMem.</span><span>
</span><span id="line-255"></span><span>
</span><span id="line-256"></span><span class="hs-comment">--      The InBoth handling is a little tricky here.  If the destination is</span><span>
</span><span id="line-257"></span><span class="hs-comment">--      InBoth, then we must ensure that the value ends up in both locations.</span><span>
</span><span id="line-258"></span><span class="hs-comment">--      An InBoth  destination must conflict with an InReg or InMem source, so</span><span>
</span><span id="line-259"></span><span class="hs-comment">--      we expand an InBoth destination as necessary.</span><span>
</span><span id="line-260"></span><span class="hs-comment">--</span><span>
</span><span id="line-261"></span><span class="hs-comment">--      An InBoth source is slightly different: we only care about the register</span><span>
</span><span id="line-262"></span><span class="hs-comment">--      that the source value is in, so that we can move it to the destinations.</span><span>
</span><span id="line-263"></span><span class="hs-comment">--</span><span>
</span><span id="line-264"></span><span id="local-6989586621681031870"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#expandNode"><span class="hs-identifier hs-type">expandNode</span></a></span><span>
</span><span id="line-265"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621681031870"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-266"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#Loc"><span class="hs-identifier hs-type">Loc</span></a></span><span>                  </span><span class="hs-comment">-- ^ source of move</span><span>
</span><span id="line-267"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#Loc"><span class="hs-identifier hs-type">Loc</span></a></span><span>                  </span><span class="hs-comment">-- ^ destination of move</span><span>
</span><span id="line-268"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Data.Graph.Directed.html#Node"><span class="hs-identifier hs-type">Node</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#Loc"><span class="hs-identifier hs-type">Loc</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681031870"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-special">]</span></span><span>
</span><span id="line-269"></span><span>
</span><span id="line-270"></span><span id="expandNode"><span class="annot"><span class="annottext">expandNode :: forall a. a -&gt; Loc -&gt; Loc -&gt; [Node Loc a]
</span><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#expandNode"><span class="hs-identifier hs-var hs-var">expandNode</span></a></span></span><span> </span><span id="local-6989586621681031675"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681031675"><span class="hs-identifier hs-var">vreg</span></a></span></span><span> </span><span id="local-6989586621681031674"><span class="annot"><span class="annottext">loc :: Loc
</span><a href="#local-6989586621681031674"><span class="hs-identifier hs-var">loc</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InReg"><span class="hs-identifier hs-type">InReg</span></a></span><span> </span><span id="local-6989586621681031672"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681031672"><span class="hs-identifier hs-var">src</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InBoth"><span class="hs-identifier hs-type">InBoth</span></a></span><span> </span><span id="local-6989586621681031670"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681031670"><span class="hs-identifier hs-var">dst</span></a></span></span><span> </span><span id="local-6989586621681031669"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681031669"><span class="hs-identifier hs-var">mem</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-271"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681031672"><span class="hs-identifier hs-var">src</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg -&gt; RealReg -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681031670"><span class="hs-identifier hs-var">dst</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">a -&gt; Loc -&gt; [Loc] -&gt; Node Loc a
forall key payload. payload -&gt; key -&gt; [key] -&gt; Node key payload
</span><a href="GHC.Data.Graph.Directed.html#DigraphNode"><span class="hs-identifier hs-var">DigraphNode</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681031675"><span class="hs-identifier hs-var">vreg</span></a></span><span> </span><span class="annot"><span class="annottext">Loc
</span><a href="#local-6989586621681031674"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Int -&gt; Loc
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InMem"><span class="hs-identifier hs-var">InMem</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681031669"><span class="hs-identifier hs-var">mem</span></a></span><span class="hs-special">]</span><span class="hs-special">]</span><span>
</span><span id="line-272"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">a -&gt; Loc -&gt; [Loc] -&gt; Node Loc a
forall key payload. payload -&gt; key -&gt; [key] -&gt; Node key payload
</span><a href="GHC.Data.Graph.Directed.html#DigraphNode"><span class="hs-identifier hs-var">DigraphNode</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681031675"><span class="hs-identifier hs-var">vreg</span></a></span><span> </span><span class="annot"><span class="annottext">Loc
</span><a href="#local-6989586621681031674"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">RealReg -&gt; Loc
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InReg"><span class="hs-identifier hs-var">InReg</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681031670"><span class="hs-identifier hs-var">dst</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Loc
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InMem"><span class="hs-identifier hs-var">InMem</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681031669"><span class="hs-identifier hs-var">mem</span></a></span><span class="hs-special">]</span><span class="hs-special">]</span><span>
</span><span id="line-273"></span><span>
</span><span id="line-274"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#expandNode"><span class="hs-identifier hs-var">expandNode</span></a></span><span> </span><span id="local-6989586621681031666"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681031666"><span class="hs-identifier hs-var">vreg</span></a></span></span><span> </span><span id="local-6989586621681031665"><span class="annot"><span class="annottext">loc :: Loc
</span><a href="#local-6989586621681031665"><span class="hs-identifier hs-var">loc</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InMem"><span class="hs-identifier hs-type">InMem</span></a></span><span> </span><span id="local-6989586621681031664"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681031664"><span class="hs-identifier hs-var">src</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InBoth"><span class="hs-identifier hs-type">InBoth</span></a></span><span> </span><span id="local-6989586621681031663"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681031663"><span class="hs-identifier hs-var">dst</span></a></span></span><span> </span><span id="local-6989586621681031662"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681031662"><span class="hs-identifier hs-var">mem</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-275"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681031664"><span class="hs-identifier hs-var">src</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681031662"><span class="hs-identifier hs-var">mem</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">a -&gt; Loc -&gt; [Loc] -&gt; Node Loc a
forall key payload. payload -&gt; key -&gt; [key] -&gt; Node key payload
</span><a href="GHC.Data.Graph.Directed.html#DigraphNode"><span class="hs-identifier hs-var">DigraphNode</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681031666"><span class="hs-identifier hs-var">vreg</span></a></span><span> </span><span class="annot"><span class="annottext">Loc
</span><a href="#local-6989586621681031665"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">RealReg -&gt; Loc
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InReg"><span class="hs-identifier hs-var">InReg</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681031663"><span class="hs-identifier hs-var">dst</span></a></span><span class="hs-special">]</span><span class="hs-special">]</span><span>
</span><span id="line-276"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">a -&gt; Loc -&gt; [Loc] -&gt; Node Loc a
forall key payload. payload -&gt; key -&gt; [key] -&gt; Node key payload
</span><a href="GHC.Data.Graph.Directed.html#DigraphNode"><span class="hs-identifier hs-var">DigraphNode</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681031666"><span class="hs-identifier hs-var">vreg</span></a></span><span> </span><span class="annot"><span class="annottext">Loc
</span><a href="#local-6989586621681031665"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">RealReg -&gt; Loc
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InReg"><span class="hs-identifier hs-var">InReg</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681031663"><span class="hs-identifier hs-var">dst</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Loc
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InMem"><span class="hs-identifier hs-var">InMem</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681031662"><span class="hs-identifier hs-var">mem</span></a></span><span class="hs-special">]</span><span class="hs-special">]</span><span>
</span><span id="line-277"></span><span>
</span><span id="line-278"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#expandNode"><span class="hs-identifier hs-var">expandNode</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span>        </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InBoth"><span class="hs-identifier hs-type">InBoth</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681031661"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681031661"><span class="hs-identifier hs-var">src</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InMem"><span class="hs-identifier hs-type">InMem</span></a></span><span> </span><span id="local-6989586621681031660"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681031660"><span class="hs-identifier hs-var">dst</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-279"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681031661"><span class="hs-identifier hs-var">src</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681031660"><span class="hs-identifier hs-var">dst</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-comment">-- guaranteed to be true</span><span>
</span><span id="line-280"></span><span>
</span><span id="line-281"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#expandNode"><span class="hs-identifier hs-var">expandNode</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span>        </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InBoth"><span class="hs-identifier hs-type">InBoth</span></a></span><span> </span><span id="local-6989586621681031659"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681031659"><span class="hs-identifier hs-var">src</span></a></span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InReg"><span class="hs-identifier hs-type">InReg</span></a></span><span> </span><span id="local-6989586621681031658"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681031658"><span class="hs-identifier hs-var">dst</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-282"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681031659"><span class="hs-identifier hs-var">src</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg -&gt; RealReg -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681031658"><span class="hs-identifier hs-var">dst</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-283"></span><span>
</span><span id="line-284"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#expandNode"><span class="hs-identifier hs-var">expandNode</span></a></span><span> </span><span id="local-6989586621681031657"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681031657"><span class="hs-identifier hs-var">vreg</span></a></span></span><span>     </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InBoth"><span class="hs-identifier hs-type">InBoth</span></a></span><span> </span><span id="local-6989586621681031656"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681031656"><span class="hs-identifier hs-var">src</span></a></span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681031655"><span class="annot"><span class="annottext">Loc
</span><a href="#local-6989586621681031655"><span class="hs-identifier hs-var">dst</span></a></span></span><span>
</span><span id="line-285"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Loc -&gt; Loc -&gt; [Node Loc a]
forall a. a -&gt; Loc -&gt; Loc -&gt; [Node Loc a]
</span><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#expandNode"><span class="hs-identifier hs-var">expandNode</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681031657"><span class="hs-identifier hs-var">vreg</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RealReg -&gt; Loc
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InReg"><span class="hs-identifier hs-var">InReg</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681031656"><span class="hs-identifier hs-var">src</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Loc
</span><a href="#local-6989586621681031655"><span class="hs-identifier hs-var">dst</span></a></span><span>
</span><span id="line-286"></span><span>
</span><span id="line-287"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#expandNode"><span class="hs-identifier hs-var">expandNode</span></a></span><span> </span><span id="local-6989586621681031654"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681031654"><span class="hs-identifier hs-var">vreg</span></a></span></span><span> </span><span id="local-6989586621681031653"><span class="annot"><span class="annottext">Loc
</span><a href="#local-6989586621681031653"><span class="hs-identifier hs-var">src</span></a></span></span><span> </span><span id="local-6989586621681031652"><span class="annot"><span class="annottext">Loc
</span><a href="#local-6989586621681031652"><span class="hs-identifier hs-var">dst</span></a></span></span><span>
</span><span id="line-288"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Loc
</span><a href="#local-6989586621681031653"><span class="hs-identifier hs-var">src</span></a></span><span> </span><span class="annot"><span class="annottext">Loc -&gt; Loc -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Loc
</span><a href="#local-6989586621681031652"><span class="hs-identifier hs-var">dst</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-289"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">a -&gt; Loc -&gt; [Loc] -&gt; Node Loc a
forall key payload. payload -&gt; key -&gt; [key] -&gt; Node key payload
</span><a href="GHC.Data.Graph.Directed.html#DigraphNode"><span class="hs-identifier hs-var">DigraphNode</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681031654"><span class="hs-identifier hs-var">vreg</span></a></span><span> </span><span class="annot"><span class="annottext">Loc
</span><a href="#local-6989586621681031653"><span class="hs-identifier hs-var">src</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Loc
</span><a href="#local-6989586621681031652"><span class="hs-identifier hs-var">dst</span></a></span><span class="hs-special">]</span><span class="hs-special">]</span><span>
</span><span id="line-290"></span><span>
</span><span id="line-291"></span><span>
</span><span id="line-292"></span><span class="hs-comment">-- | Generate fixup code for a particular component in the move graph</span><span>
</span><span id="line-293"></span><span class="hs-comment">--      This component tells us what values need to be moved to what</span><span>
</span><span id="line-294"></span><span class="hs-comment">--      destinations. We have eliminated any possibility of single-node</span><span>
</span><span id="line-295"></span><span class="hs-comment">--      cycles in expandNode above.</span><span>
</span><span id="line-296"></span><span class="hs-comment">--</span><span>
</span><span id="line-297"></span><span id="local-6989586621681031883"><span id="local-6989586621681031884"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#handleComponent"><span class="hs-identifier hs-type">handleComponent</span></a></span><span>
</span><span id="line-298"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#Instruction"><span class="hs-identifier hs-type">Instruction</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681031884"><span class="hs-identifier hs-type">instr</span></a></span><span>
</span><span id="line-299"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621681031884"><span class="hs-identifier hs-type">instr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../containers/src/Data.Graph.html#SCC"><span class="hs-identifier hs-type">SCC</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Graph.Directed.html#Node"><span class="hs-identifier hs-type">Node</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#Loc"><span class="hs-identifier hs-type">Loc</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Unique.html#Unique"><span class="hs-identifier hs-type">Unique</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-300"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.State.html#RegM"><span class="hs-identifier hs-type">RegM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681031883"><span class="hs-identifier hs-type">freeRegs</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621681031884"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span></span></span><span>
</span><span id="line-301"></span><span>
</span><span id="line-302"></span><span class="hs-comment">-- If the graph is acyclic then we won't get the swapping problem below.</span><span>
</span><span id="line-303"></span><span class="hs-comment">--      In this case we can just do the moves directly, and avoid having to</span><span>
</span><span id="line-304"></span><span class="hs-comment">--      go via a spill slot.</span><span>
</span><span id="line-305"></span><span class="hs-comment">--</span><span>
</span><span id="line-306"></span><span id="handleComponent"><span class="annot"><span class="annottext">handleComponent :: forall instr freeRegs.
Instruction instr =&gt;
Int -&gt; instr -&gt; SCC (Node Loc Unique) -&gt; RegM freeRegs [instr]
</span><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#handleComponent"><span class="hs-identifier hs-var hs-var">handleComponent</span></a></span></span><span> </span><span id="local-6989586621681031636"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681031636"><span class="hs-identifier hs-var">delta</span></a></span></span><span> </span><span class="annot"><span class="annottext">instr
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="../../containers/src/Data.Graph.html#AcyclicSCC"><span class="hs-identifier hs-type">AcyclicSCC</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Graph.Directed.html#DigraphNode"><span class="hs-identifier hs-type">DigraphNode</span></a></span><span> </span><span id="local-6989586621681031634"><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681031634"><span class="hs-identifier hs-var">vreg</span></a></span></span><span> </span><span id="local-6989586621681031633"><span class="annot"><span class="annottext">Loc
</span><a href="#local-6989586621681031633"><span class="hs-identifier hs-var">src</span></a></span></span><span> </span><span id="local-6989586621681031632"><span class="annot"><span class="annottext">[Loc]
</span><a href="#local-6989586621681031632"><span class="hs-identifier hs-var">dsts</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-307"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Loc -&gt; RegM freeRegs instr) -&gt; [Loc] -&gt; RegM freeRegs [instr]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Unique -&gt; Loc -&gt; Loc -&gt; RegM freeRegs instr
forall instr freeRegs.
Instruction instr =&gt;
Int -&gt; Unique -&gt; Loc -&gt; Loc -&gt; RegM freeRegs instr
</span><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#makeMove"><span class="hs-identifier hs-var">makeMove</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681031636"><span class="hs-identifier hs-var">delta</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681031634"><span class="hs-identifier hs-var">vreg</span></a></span><span> </span><span class="annot"><span class="annottext">Loc
</span><a href="#local-6989586621681031633"><span class="hs-identifier hs-var">src</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Loc]
</span><a href="#local-6989586621681031632"><span class="hs-identifier hs-var">dsts</span></a></span><span>
</span><span id="line-308"></span><span>
</span><span id="line-309"></span><span>
</span><span id="line-310"></span><span class="hs-comment">-- Handle some cyclic moves.</span><span>
</span><span id="line-311"></span><span class="hs-comment">--      This can happen if we have two regs that need to be swapped.</span><span>
</span><span id="line-312"></span><span class="hs-comment">--      eg:</span><span>
</span><span id="line-313"></span><span class="hs-comment">--           vreg   source loc   dest loc</span><span>
</span><span id="line-314"></span><span class="hs-comment">--          (vreg1, InReg r1,    [InReg r2])</span><span>
</span><span id="line-315"></span><span class="hs-comment">--          (vreg2, InReg r2,    [InReg r1])</span><span>
</span><span id="line-316"></span><span class="hs-comment">--</span><span>
</span><span id="line-317"></span><span class="hs-comment">--      To avoid needing temp register, we just spill all the source regs, then</span><span>
</span><span id="line-318"></span><span class="hs-comment">--      reaload them into their destination regs.</span><span>
</span><span id="line-319"></span><span class="hs-comment">--</span><span>
</span><span id="line-320"></span><span class="hs-comment">--      Note that we can not have cycles that involve memory locations as</span><span>
</span><span id="line-321"></span><span class="hs-comment">--      sources as single destination because memory locations (stack slots)</span><span>
</span><span id="line-322"></span><span class="hs-comment">--      are allocated exclusively for a virtual register and therefore can not</span><span>
</span><span id="line-323"></span><span class="hs-comment">--      require a fixup.</span><span>
</span><span id="line-324"></span><span class="hs-comment">--</span><span>
</span><span id="line-325"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#handleComponent"><span class="hs-identifier hs-var">handleComponent</span></a></span><span> </span><span id="local-6989586621681031630"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681031630"><span class="hs-identifier hs-var">delta</span></a></span></span><span> </span><span id="local-6989586621681031629"><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681031629"><span class="hs-identifier hs-var">instr</span></a></span></span><span>
</span><span id="line-326"></span><span>        </span><span class="hs-special">(</span><span class="annot"><a href="../../containers/src/Data.Graph.html#CyclicSCC"><span class="hs-identifier hs-type">CyclicSCC</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Graph.Directed.html#DigraphNode"><span class="hs-identifier hs-type">DigraphNode</span></a></span><span> </span><span id="local-6989586621681031627"><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681031627"><span class="hs-identifier hs-var">vreg</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InReg"><span class="hs-identifier hs-type">InReg</span></a></span><span> </span><span id="local-6989586621681031626"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681031626"><span class="hs-identifier hs-var">sreg</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InReg"><span class="hs-identifier hs-type">InReg</span></a></span><span> </span><span id="local-6989586621681031625"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681031625"><span class="hs-identifier hs-var">dreg</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span class="annot"><span class="annottext">[Loc]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621681031624"><span class="annot"><span class="annottext">[Node Loc Unique]
</span><a href="#local-6989586621681031624"><span class="hs-identifier hs-var">rest</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-327"></span><span>        </span><span class="hs-comment">-- dest list may have more than one element, if the reg is also InMem.</span><span>
</span><span id="line-328"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-329"></span><span>        </span><span class="hs-comment">-- spill the source into its slot</span><span>
</span><span id="line-330"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621681031623"><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681031623"><span class="hs-identifier hs-var">instrSpill</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681031622"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681031622"><span class="hs-identifier hs-var">slot</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-331"></span><span>                        </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Reg -&gt; Unique -&gt; RegM freeRegs (instr, Int)
forall instr freeRegs.
Instruction instr =&gt;
Reg -&gt; Unique -&gt; RegM freeRegs (instr, Int)
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#spillR"><span class="hs-identifier hs-var">spillR</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RealReg -&gt; Reg
</span><a href="GHC.Platform.Reg.html#RegReal"><span class="hs-identifier hs-var">RegReal</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681031626"><span class="hs-identifier hs-var">sreg</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681031627"><span class="hs-identifier hs-var">vreg</span></a></span><span>
</span><span id="line-332"></span><span>
</span><span id="line-333"></span><span>        </span><span class="hs-comment">-- reload into destination reg</span><span>
</span><span id="line-334"></span><span>        </span><span id="local-6989586621681031619"><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681031619"><span class="hs-identifier hs-var">instrLoad</span></a></span></span><span>       </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Reg -&gt; Int -&gt; RegM freeRegs instr
forall instr freeRegs.
Instruction instr =&gt;
Reg -&gt; Int -&gt; RegM freeRegs instr
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#loadR"><span class="hs-identifier hs-var">loadR</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RealReg -&gt; Reg
</span><a href="GHC.Platform.Reg.html#RegReal"><span class="hs-identifier hs-var">RegReal</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681031625"><span class="hs-identifier hs-var">dreg</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681031622"><span class="hs-identifier hs-var">slot</span></a></span><span>
</span><span id="line-335"></span><span>
</span><span id="line-336"></span><span>        </span><span id="local-6989586621681031617"><span class="annot"><span class="annottext">[[instr]]
</span><a href="#local-6989586621681031617"><span class="hs-identifier hs-var">remainingFixUps</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(SCC (Node Loc Unique) -&gt; RegM freeRegs [instr])
-&gt; [SCC (Node Loc Unique)] -&gt; RegM freeRegs [[instr]]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; instr -&gt; SCC (Node Loc Unique) -&gt; RegM freeRegs [instr]
forall instr freeRegs.
Instruction instr =&gt;
Int -&gt; instr -&gt; SCC (Node Loc Unique) -&gt; RegM freeRegs [instr]
</span><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#handleComponent"><span class="hs-identifier hs-var">handleComponent</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681031630"><span class="hs-identifier hs-var">delta</span></a></span><span> </span><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681031629"><span class="hs-identifier hs-var">instr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-337"></span><span>                                </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Node Loc Unique] -&gt; [SCC (Node Loc Unique)]
forall key payload.
Ord key =&gt;
[Node key payload] -&gt; [SCC (Node key payload)]
</span><a href="GHC.Data.Graph.Directed.html#stronglyConnCompFromEdgedVerticesOrdR"><span class="hs-identifier hs-var">stronglyConnCompFromEdgedVerticesOrdR</span></a></span><span> </span><span class="annot"><span class="annottext">[Node Loc Unique]
</span><a href="#local-6989586621681031624"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-338"></span><span>
</span><span id="line-339"></span><span>        </span><span class="hs-comment">-- make sure to do all the reloads after all the spills,</span><span>
</span><span id="line-340"></span><span>        </span><span class="hs-comment">--      so we don't end up clobbering the source values.</span><span>
</span><span id="line-341"></span><span>        </span><span class="annot"><span class="annottext">[instr] -&gt; RegM freeRegs [instr]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681031623"><span class="hs-identifier hs-var">instrSpill</span></a></span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[instr] -&gt; [instr] -&gt; [instr]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[[instr]] -&gt; [instr]
forall (t :: * -&gt; *) a. Foldable t =&gt; t [a] -&gt; [a]
</span><a href="../../base/src/Data.Foldable.html#concat"><span class="hs-identifier hs-var">concat</span></a></span><span> </span><span class="annot"><span class="annottext">[[instr]]
</span><a href="#local-6989586621681031617"><span class="hs-identifier hs-var">remainingFixUps</span></a></span><span> </span><span class="annot"><span class="annottext">[instr] -&gt; [instr] -&gt; [instr]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681031619"><span class="hs-identifier hs-var">instrLoad</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-342"></span><span>
</span><span id="line-343"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#handleComponent"><span class="hs-identifier hs-var">handleComponent</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">instr
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../containers/src/Data.Graph.html#CyclicSCC"><span class="hs-identifier hs-type">CyclicSCC</span></a></span><span> </span><span class="annot"><span class="annottext">[Node Loc Unique]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>
</span><span id="line-344"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; RegM freeRegs [instr]
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Register Allocator: handleComponent cyclic&quot;</span></span><span>
</span><span id="line-345"></span><span>
</span><span id="line-346"></span><span>
</span><span id="line-347"></span><span class="hs-comment">-- | Move a vreg between these two locations.</span><span>
</span><span id="line-348"></span><span class="hs-comment">--</span><span>
</span><span id="line-349"></span><span id="local-6989586621681031863"><span id="local-6989586621681031864"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#makeMove"><span class="hs-identifier hs-type">makeMove</span></a></span><span>
</span><span id="line-350"></span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#Instruction"><span class="hs-identifier hs-type">Instruction</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681031864"><span class="hs-identifier hs-type">instr</span></a></span><span>
</span><span id="line-351"></span><span>    </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>      </span><span class="hs-comment">-- ^ current C stack delta.</span><span>
</span><span id="line-352"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Unique.html#Unique"><span class="hs-identifier hs-type">Unique</span></a></span><span>   </span><span class="hs-comment">-- ^ unique of the vreg that we're moving.</span><span>
</span><span id="line-353"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#Loc"><span class="hs-identifier hs-type">Loc</span></a></span><span>      </span><span class="hs-comment">-- ^ source location.</span><span>
</span><span id="line-354"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#Loc"><span class="hs-identifier hs-type">Loc</span></a></span><span>      </span><span class="hs-comment">-- ^ destination location.</span><span>
</span><span id="line-355"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.State.html#RegM"><span class="hs-identifier hs-type">RegM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681031863"><span class="hs-identifier hs-type">freeRegs</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681031864"><span class="hs-identifier hs-type">instr</span></a></span></span></span><span>  </span><span class="hs-comment">-- ^ move instruction.</span><span>
</span><span id="line-356"></span><span>
</span><span id="line-357"></span><span id="makeMove"><span class="annot"><span class="annottext">makeMove :: forall instr freeRegs.
Instruction instr =&gt;
Int -&gt; Unique -&gt; Loc -&gt; Loc -&gt; RegM freeRegs instr
</span><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#makeMove"><span class="hs-identifier hs-var hs-var">makeMove</span></a></span></span><span> </span><span id="local-6989586621681031599"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681031599"><span class="hs-identifier hs-var">delta</span></a></span></span><span> </span><span id="local-6989586621681031598"><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681031598"><span class="hs-identifier hs-var">vreg</span></a></span></span><span> </span><span id="local-6989586621681031597"><span class="annot"><span class="annottext">Loc
</span><a href="#local-6989586621681031597"><span class="hs-identifier hs-var">src</span></a></span></span><span> </span><span id="local-6989586621681031596"><span class="annot"><span class="annottext">Loc
</span><a href="#local-6989586621681031596"><span class="hs-identifier hs-var">dst</span></a></span></span><span>
</span><span id="line-358"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621681031595"><span class="annot"><span class="annottext">NCGConfig
</span><a href="#local-6989586621681031595"><span class="hs-identifier hs-var">config</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RegM freeRegs NCGConfig
forall a. RegM a NCGConfig
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#getConfig"><span class="hs-identifier hs-var">getConfig</span></a></span><span>
</span><span id="line-359"></span><span>      </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681031594"><span class="annot"><span class="annottext">platform :: Platform
</span><a href="#local-6989586621681031594"><span class="hs-identifier hs-var hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NCGConfig -&gt; Platform
</span><a href="GHC.CmmToAsm.Config.html#ncgPlatform"><span class="hs-identifier hs-var hs-var">ncgPlatform</span></a></span><span> </span><span class="annot"><span class="annottext">NCGConfig
</span><a href="#local-6989586621681031595"><span class="hs-identifier hs-var">config</span></a></span><span>
</span><span id="line-360"></span><span>
</span><span id="line-361"></span><span>      </span><span class="hs-keyword">case</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Loc
</span><a href="#local-6989586621681031597"><span class="hs-identifier hs-var">src</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Loc
</span><a href="#local-6989586621681031596"><span class="hs-identifier hs-var">dst</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-362"></span><span>          </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InReg"><span class="hs-identifier hs-type">InReg</span></a></span><span> </span><span id="local-6989586621681031593"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681031593"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InReg"><span class="hs-identifier hs-type">InReg</span></a></span><span> </span><span id="local-6989586621681031592"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681031592"><span class="hs-identifier hs-var">d</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-363"></span><span>              </span><span class="hs-keyword">do</span><span> </span><span class="annot"><span class="annottext">SpillReason -&gt; RegM freeRegs ()
forall freeRegs. SpillReason -&gt; RegM freeRegs ()
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#recordSpill"><span class="hs-identifier hs-var">recordSpill</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Unique -&gt; SpillReason
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#SpillJoinRR"><span class="hs-identifier hs-var">SpillJoinRR</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681031598"><span class="hs-identifier hs-var">vreg</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-364"></span><span>                 </span><span class="annot"><span class="annottext">instr -&gt; RegM freeRegs instr
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(instr -&gt; RegM freeRegs instr) -&gt; instr -&gt; RegM freeRegs instr
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Platform -&gt; Reg -&gt; Reg -&gt; instr
forall instr. Instruction instr =&gt; Platform -&gt; Reg -&gt; Reg -&gt; instr
</span><a href="GHC.CmmToAsm.Instr.html#mkRegRegMoveInstr"><span class="hs-identifier hs-var">mkRegRegMoveInstr</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681031594"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RealReg -&gt; Reg
</span><a href="GHC.Platform.Reg.html#RegReal"><span class="hs-identifier hs-var">RegReal</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681031593"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RealReg -&gt; Reg
</span><a href="GHC.Platform.Reg.html#RegReal"><span class="hs-identifier hs-var">RegReal</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681031592"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-365"></span><span>          </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InMem"><span class="hs-identifier hs-type">InMem</span></a></span><span> </span><span id="local-6989586621681031588"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681031588"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InReg"><span class="hs-identifier hs-type">InReg</span></a></span><span> </span><span id="local-6989586621681031587"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681031587"><span class="hs-identifier hs-var">d</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-366"></span><span>              </span><span class="hs-keyword">do</span><span> </span><span class="annot"><span class="annottext">SpillReason -&gt; RegM freeRegs ()
forall freeRegs. SpillReason -&gt; RegM freeRegs ()
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#recordSpill"><span class="hs-identifier hs-var">recordSpill</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Unique -&gt; SpillReason
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#SpillJoinRM"><span class="hs-identifier hs-var">SpillJoinRM</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681031598"><span class="hs-identifier hs-var">vreg</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-367"></span><span>                 </span><span class="annot"><span class="annottext">instr -&gt; RegM freeRegs instr
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(instr -&gt; RegM freeRegs instr) -&gt; instr -&gt; RegM freeRegs instr
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">NCGConfig -&gt; Reg -&gt; Int -&gt; Int -&gt; instr
forall instr.
Instruction instr =&gt;
NCGConfig -&gt; Reg -&gt; Int -&gt; Int -&gt; instr
</span><a href="GHC.CmmToAsm.Instr.html#mkLoadInstr"><span class="hs-identifier hs-var">mkLoadInstr</span></a></span><span> </span><span class="annot"><span class="annottext">NCGConfig
</span><a href="#local-6989586621681031595"><span class="hs-identifier hs-var">config</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RealReg -&gt; Reg
</span><a href="GHC.Platform.Reg.html#RegReal"><span class="hs-identifier hs-var">RegReal</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681031587"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681031599"><span class="hs-identifier hs-var">delta</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681031588"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-368"></span><span>          </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InReg"><span class="hs-identifier hs-type">InReg</span></a></span><span> </span><span id="local-6989586621681031584"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681031584"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InMem"><span class="hs-identifier hs-type">InMem</span></a></span><span> </span><span id="local-6989586621681031583"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681031583"><span class="hs-identifier hs-var">d</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-369"></span><span>              </span><span class="hs-keyword">do</span><span> </span><span class="annot"><span class="annottext">SpillReason -&gt; RegM freeRegs ()
forall freeRegs. SpillReason -&gt; RegM freeRegs ()
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#recordSpill"><span class="hs-identifier hs-var">recordSpill</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Unique -&gt; SpillReason
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#SpillJoinRM"><span class="hs-identifier hs-var">SpillJoinRM</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681031598"><span class="hs-identifier hs-var">vreg</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-370"></span><span>                 </span><span class="annot"><span class="annottext">instr -&gt; RegM freeRegs instr
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(instr -&gt; RegM freeRegs instr) -&gt; instr -&gt; RegM freeRegs instr
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">NCGConfig -&gt; Reg -&gt; Int -&gt; Int -&gt; instr
forall instr.
Instruction instr =&gt;
NCGConfig -&gt; Reg -&gt; Int -&gt; Int -&gt; instr
</span><a href="GHC.CmmToAsm.Instr.html#mkSpillInstr"><span class="hs-identifier hs-var">mkSpillInstr</span></a></span><span> </span><span class="annot"><span class="annottext">NCGConfig
</span><a href="#local-6989586621681031595"><span class="hs-identifier hs-var">config</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RealReg -&gt; Reg
</span><a href="GHC.Platform.Reg.html#RegReal"><span class="hs-identifier hs-var">RegReal</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681031584"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681031599"><span class="hs-identifier hs-var">delta</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681031583"><span class="hs-identifier hs-var">d</span></a></span><span>
</span><span id="line-371"></span><span>          </span><span class="annot"><span class="annottext">(Loc, Loc)
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-372"></span><span>              </span><span class="hs-comment">-- we don't handle memory to memory moves.</span><span>
</span><span id="line-373"></span><span>              </span><span class="hs-comment">-- they shouldn't happen because we don't share</span><span>
</span><span id="line-374"></span><span>              </span><span class="hs-comment">-- stack slots between vregs.</span><span>
</span><span id="line-375"></span><span>              </span><span class="annot"><span class="annottext">String -&gt; RegM freeRegs instr
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;makeMove &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">Unique -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681031598"><span class="hs-identifier hs-var">vreg</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot; (&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">Loc -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">Loc
</span><a href="#local-6989586621681031597"><span class="hs-identifier hs-var">src</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;) (&quot;</span></span><span>
</span><span id="line-376"></span><span>                  </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">Loc -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">Loc
</span><a href="#local-6989586621681031596"><span class="hs-identifier hs-var">dst</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;)&quot;</span></span><span>
</span><span id="line-377"></span><span>                  </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot; we don't handle mem-&gt;mem moves.&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-378"></span><span>
</span><span id="line-379"></span></pre></body></html>